<?php

namespace App\Controller\My;


use App\Controller\BaseController;
use App\Request\My\CallIncomeRequest;
use App\Request\My\CashRecordRequest;
use App\Request\My\IncomeExpenseRequest;
use App\Request\My\PayRecordRequest;
use App\Services\My\WalletService;
use Hyperf\Context\Context;
use Hyperf\Di\Annotation\Inject;

class WalletController extends BaseController
{

    #[Inject]
    public WalletService $walletService;


    /**
     * Note - 个人中心-提现记录列表
     * DateTime 2024/8/8 16:15
     * User Admin
     */
    public function cashRecord(CashRecordRequest $request)
    {
        $userInfo = Context::get('user');
        $params = $this->request->post();
        $request->execute($params);
        $params['language'] = Context::get('language');
        return $this->return($this->walletService->cashRecord($userInfo['id'], $params));

    }


    /**
     * Note - 个人中心-充值记录列表
     * DateTime 2024/8/12 15:24
     * User Admin
     */
    public function payRecord(PayRecordRequest $request)
    {
        $userInfo = Context::get('user');
        $params = $this->request->post();
        $request->execute($params);
        $params['language'] = Context::get('language');
        return $this->return($this->walletService->payRecord($userInfo['id'], $params));

    }


    /**
     * Note - 个人中心-收支明细
     * DateTime 2024/8/12 16:33
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function incomeExpense(IncomeExpenseRequest $request)
    {
        $userInfo = Context::get('user');
        $params = $this->request->post();
        $request->execute($params);
        $params['language'] = Context::get('language');
        return $this->return($this->walletService->incomeExpense($userInfo['id'], $params));

    }


    /**
     * Note - 个人中心-通话收支明细
     * DateTime 2024/8/12 17:22
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function callIncome(CallIncomeRequest $request)
    {
        $userInfo = Context::get('user');
        $params = $this->request->post();
        $request->execute($params);
        $params['language'] = Context::get('language');
        return $this->return($this->walletService->callIncome($userInfo, $params));

    }


    /**
     * Note - 个人中心-钱包
     * DateTime 2024/8/12 17:22
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function wallet()
    {
        $userInfo = Context::get('user');
        return $this->return($this->walletService->wallet($userInfo));

    }

}